package com.example.demo.bean;


/**
 * @Desc
 * @Author zxp
 * @Date 2024/3/14
 */
public class BaseBean<T> {

    // 编码，200成功，其他失败
    public static final Integer CODE_SUCCESS = 200;

    private Integer code;

    // 数据
    private T data;

    // 信息
    private String msg;

    public BaseBean() {
    }

    public BaseBean(Integer code, T data, String msg) {
        this.code = code;
        this.data = data;
        this.msg = msg;
    }

    public boolean successful() {
        if (CODE_SUCCESS.equals(code)) {
            return true;
        }
        return false;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public String toString() {
        return "BaseBean{" +
                "code=" + code +
                ", data=" + data +
                ", msg='" + msg + '\'' +
                '}';
    }
}
